<%--
  Created by IntelliJ IDEA.
  User: MECHREVO
  Date: 2021/4/15
  Time: 8:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
<body>
    <input type="button" value="text" name="text" onclick="text()">
</body>
<script type="text/javascript">
    function text(){
        var obj ={
            "name": "feiyue",
            "level": 99,
            "age": 18,
            "skillList": [
            {
                "id": 1,
                "name": "天下无双",
                "damage": "123"
            },
            {
                "id": 2,
                "name": "雌雄难辨",
                "damage": "182"
            },
            {
                "id": 3,
                "name": "暗流涌动",
                "damage": "89"
            }
        ]
        }
        alert("年龄---"+obj.age);
        for (var i=0;i<obj.skillList.length;i++){
            if(obj.skillList[i].id ==2){
                alert("id为2的名字---"+obj.skillList[i].name);
            }
        }

    }
</script>
</html>
